<?php
// +----------------------------------------------------------------------
// | Author: 闪电 <573725206@qq.com>
// +----------------------------------------------------------------------

namespace Admin\Controller;
use Common\Controller\AuthController;

class CustomerController extends AuthController {
	//列表
	public function index() {
		//添置按钮
		$array[] = array('title' => '添加客户', 'url' => U('add'), 'class' => 'primary', 'type' => 'button', 'target' => 'myModal');
		$this->assign('add_button', add_button($array));

		$number = 22; //模型id
		//获取模型表单数据
		$this->FormHtml($number);
		$this->assign('FormConfig', array('title' => '添加客户', 'url' => U('add', array('mid' => $number))));
		$type[] = array('title' => '编缉', 'url' => 'rom', 'class' => 'default', 'type' => 'rom');
		$type[] = array('title' => '删除', 'url' => 'Index/del', 'class' => 'danger', 'type' => 'delete');

		//组id等于1为管理员权限，否则按用户查询
		if (GetuserGroupAccess() != 1) {
			$this->assign('where', array('uid' => getuserid()));
		}
		$this->assign('array', $type);
		$this->display('Public/_List');

	}

	//新增
	public function add() {

		if (IS_POST) {
			$this->PublicDataModel(I('get.mid', '', 'intval'));
		}
	}
	public function rom() {
		$mid = I('get.mid', '', 'intval');
		$id = I('get.id', '', 'intval');
		if (IS_POST) {
			$this->PublicDataModel($mid, $id, U('index'));
		} else {
			$this->PublicDataModel($mid, $id);
		}
	}

}
